SET ANSI_NULLS ON
SET QUOTED_IDENTIFIER ON
GO

-- =============================================
-- Modified:    Jeff Green
-- Create date: 6/7/2011
-- Description:	The procedure returns all of the movies in a customer's queue for human-readable display

-- =============================================

IF EXISTS (SELECT name FROM sysobjects WHERE name = 'mov_getCustomerQueueForDisplay' AND type = 'P') DROP PROCEDURE mov_getCustomerQueueForDisplay
GO

CREATE PROCEDURE [dbo].[mov_getCustomerQueueForDisplay]
	@email varchar(40)
AS
BEGIN
	SELECT m.movie_name as Movie, (md.movie_dir_fname + ' ' +  md.movie_dir_lname) as Director , mg.movie_genre as Genre
    --,m.movie_image
	--, m.short_desc as Description
	FROM [dbo].[customer] c
	INNER JOIN [dbo].[cus_queue] q ON c.cus_id = q.cus_id
	INNER JOIN [dbo].[movie] m ON q.movie_id = m.movie_id
	JOIN [dbo].[movie_director] md ON m.movie_dir_id= md.movie_dir_id
	JOIN [dbo].[movie_genre] mg ON m.movie_genre_id = mg.movie_genre_id
	WHERE c.cus_email = @email
	ORDER BY q.que_order

END
